<template>
  <div class="goods-info" @click="goGoodsPage()">
    <div class="godds-image">
      <img v-lazy="goodsImage" width="70%" alt="">
    </div>
    <div class="goods-name">{{goodsName}}</div>
    <div class="goods-price">￥{{goodsPrice | moneyFilter}}</div>
  </div>
</template>

<script>
import {toMoney} from '@/filter/moneyFilter.js'
export default {
  props:['goodsImage','goodsName','goodsPrice','goodsId'],
  data() {
    return {

    }
  },
  methods: {
    goGoodsPage(){
      this.$router.push({name:'Goods',query:{goodsId:this.goodsId}})
    }
  },
  components: {

  },
  filters:{
    moneyFilter(money){
      return toMoney(money)
    }
  }
}
</script>

<style lang="scss" scoped>
  .goods-info{
    box-sizing: border-box;
    border:.5px solid #eee;
    color: #333;
  }
  .goods-name{
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2rem;
  }
  .goods-price{
    line-height: 1.2rem;
    color:rgb(245, 132, 87);
  }
</style>


